package com.ns.sbs.oauth.acc.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

/**
 * 用户全量信息
 *
 * @author liaowei
 */
@EqualsAndHashCode(callSuper = true)
@Data
@ToString
@Accessors(chain = true)
public class AccCompleteVO extends AccVO {

    /**
     * 密码
     */
    private String password;

    /**
     * 所属租户
     */
    @JsonSerialize(using = ToStringSerializer.class)
    private Long rid;
    /**
     * 上次登陆时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date loginTime;


    /**
     * 登陆次数
     */
    private Integer loginCount;

    /**
     * 防止密码被传递到前台
     */
    public String getPassword() {
        return "********";
    }

    /**
     * 获取真实密码
     */
    @JsonIgnore()
    public String getPassword2() {
        return this.password;
    }
}
